<meta charset="utf-8">
<style>
    body{
        background:url(background.jpg);
         background-size:cover;
    }
</style>

<img id="pic"
     style="position:absolute;right:100px;top:100px"
     src="1 (1).png" />

<script>
    var i = 1;
    var j=100;
    
    function f(){
        if(i==32){
         i = 1;
       }

        pic.src = "1 ("+i+").png";
        i++;
        pic.style="position:absolute;right:"+j+"px;top:100px";
        j=j+2;
       if(j>=1150){
           pic.style="position:absolute;right:1150px;top:100px";
       }
       
    }
    setInterval(f,100);
</script>
